﻿<UserControl x:Class="SocketChat.control.InkWrite"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="650" Height="300" Foreground="White">
    <Grid x:Name="LayoutRoot" Background="Gray">
        <Grid.RowDefinitions>
            <RowDefinition Height="25"></RowDefinition>
           
            <RowDefinition></RowDefinition>
            <RowDefinition Height="25"></RowDefinition>
            
        </Grid.RowDefinitions>
        
        
        <StackPanel x:Name="spToolBar" Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" Height="25" VerticalAlignment="Center">
            <TextBlock Text="笔划颜色：" VerticalAlignment="Center"></TextBlock>
            <ComboBox x:Name="cboColor" Width="65" VerticalAlignment="Center">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Rectangle Fill="{Binding Color}" ToolTipService.ToolTip="{Binding Name}" Width="10" Height="10"/>
                            <TextBlock Text="{Binding Name}" Margin="2,0,0,0" Foreground="{Binding Color}"></TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Text="笔划外框颜色：" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
            <ComboBox x:Name="cboOutlineColor" Width="65" VerticalAlignment="Center">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Rectangle Fill="{Binding Color}" ToolTipService.ToolTip="{Binding Name}" Width="10" Height="10"/>
                            <TextBlock Text="{Binding Name}" Margin="2,0,0,0" Foreground="{Binding Color}"></TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Text="笔划宽度：" Margin="10,0,0,0" VerticalAlignment="Center"></TextBlock>
            <ComboBox x:Name="cboWidth" Width="60" VerticalAlignment="Center" Height="20">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Rectangle Fill="Black" Width="40" Height="{Binding Size}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Text="笔划高度：" Margin="10,0,0,0" VerticalAlignment="Center"></TextBlock>
            <ComboBox x:Name="cboHeight" Width="60" VerticalAlignment="Center" Height="20">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Rectangle Fill="Black" Width="40" Height="{Binding Size}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Text="透明度：" Margin="10,0,0,0" VerticalAlignment="Center"></TextBlock>
            <ComboBox x:Name="cboOpactiy" Width="60" VerticalAlignment="Center" SelectionChanged="cboOpactiy_SelectionChanged" Foreground="Black">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Value}" Opacity="{Binding Value}" ></TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>
        
        <Rectangle Width="650" Height="250" Grid.Row="1" Fill="White" Stroke="Black"></Rectangle>

        <InkPresenter x:Name="ink" Height="250" Width="650" Grid.Row="1"            
              Background="White" Opacity="1"                       
              MouseLeftButtonDown="OnMouseLeftButtonDown"
              MouseMove="OnMouseMove"
              LostMouseCapture="OnLostMouseCapture" Margin="0"
              >
            <InkPresenter.Clip>
                <RectangleGeometry Rect="0,0,650,250"></RectangleGeometry>
            </InkPresenter.Clip>
        </InkPresenter>
		
		<StackPanel Grid.Row="2" Height="25" Orientation="Horizontal" HorizontalAlignment="Center">
			<Button x:Name="btnSend" Content=" 发 送 " Width="70" Height="22" Click="btnSend_Click"></Button>
			<Button x:Name="btnClear" Content=" 清 空 " Width="70" Margin="5,0,0,0" Height="22"  Click="btnClear_Click"></Button>
			<Button x:Name="btnClose" Content=" 关 闭 " Width="70" Margin="5,0,0,0" Height="22" Click="btnClose_Click"></Button>
		</StackPanel>
    </Grid>
</UserControl>
